package com.hp.ssm.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hp.ssm.bean.Woom;
import com.hp.ssm.bean.WoomExample;
import com.hp.ssm.mapper.WoomMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class WoomServiceImp implements WoomService {

    @Resource
    private WoomMapper mapper;

    @Override
    public PageInfo<Woom> pageFind(WoomExample example, Integer page, Integer limit) {
        PageHelper.startPage(page,limit);
        List<Woom> list=mapper.selectByExample(example);
        PageInfo<Woom> pageInfo=new PageInfo<Woom>(list);
        return pageInfo;
    }

    @Override
    public Woom findByid(Integer wid) {
        return mapper.selectByPrimaryKey(wid);
    }

    @Override
    public int add(Woom obj) {
        return mapper.insertSelective(obj);
    }

    @Override
    public int update(Woom obj) {
        return mapper.updateByPrimaryKeySelective(obj);
    }

    @Override
    public int del(Integer wid) {
        return mapper.deleteByPrimaryKey(wid);
    }
}
